import Mock from "mockjs";
Mock.Random.extend({
    phone: function() {
        var phonePrefixs = ["132", "135", "189"];
        return this.pick(phonePrefixs) + Mock.mock(/\d{8}/);
    },
});
Mock.Random.extend({
    gh: function() {
        var ghPrefixs = ["25"];
        return this.pick(ghPrefixs) + Mock.mock(/\d{3}/);
    },
});
// 定义数据类型
let data = Mock.mock({
    // 20条数据
    "data|6": [{
        "num|+1": 1,
        name: "@cname",
        gh: "@gh",
        "sex|1": ["男", "女"],
        // 手机号
        phone: "@phone",
        // 方式
        //时间
        regTime: "@date(2021-MM-dd)",
        updateTime: "@date(2022-MM-dd)",
        //
        "zt|1": ["在职", "离职"],
        //商品名称
        allMoney: "@natural(3000, 6000)",
        relax: "@natural(0, 6)",
        //商品地址
        nc: "@ctitle(2)",
        flag: false,
    }, ],
});

class kfAccountService {
    getDate() {
        return Promise.resolve({
            data,
        });
    }
    edit(id) {
        let obj = {};
        data.data = data.data.filter((item) => {
            console.log(item);
            if (item.gh == id) {
                obj = item;
            }
            return data;
        });
        return Promise.resolve(obj);
    }
}

const kfAccount = new kfAccountService();
export default kfAccount;